Public Class frmGLAPTransAdd
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents rbDmemo As System.Windows.Forms.RadioButton
    Friend WithEvents rbCmemo As System.Windows.Forms.RadioButton
    Friend WithEvents tbDocNum As System.Windows.Forms.TextBox
    Friend WithEvents tbRefer As System.Windows.Forms.TextBox
    Friend WithEvents tbFc As System.Windows.Forms.TextBox
    Friend WithEvents tbFcAmt As System.Windows.Forms.TextBox
    Friend WithEvents GroupPanel1 As DevComponents.DotNetBar.Controls.GroupPanel
    Friend WithEvents GroupPanel2 As DevComponents.DotNetBar.Controls.GroupPanel
    Friend WithEvents LabelX5 As DevComponents.DotNetBar.LabelX
    Friend WithEvents LabelX4 As DevComponents.DotNetBar.LabelX
    Friend WithEvents LabelX3 As DevComponents.DotNetBar.LabelX
    Friend WithEvents LabelX2 As DevComponents.DotNetBar.LabelX
    Friend WithEvents LabelX1 As DevComponents.DotNetBar.LabelX
    Friend WithEvents cbCustomer As DevComponents.DotNetBar.Controls.ComboBoxEx
    Friend WithEvents cmdExit As DevComponents.DotNetBar.ButtonX
    Friend WithEvents cmdSave As DevComponents.DotNetBar.ButtonX
    Friend WithEvents tbCusCode As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.tbDocNum = New System.Windows.Forms.TextBox()
        Me.rbDmemo = New System.Windows.Forms.RadioButton()
        Me.rbCmemo = New System.Windows.Forms.RadioButton()
        Me.tbRefer = New System.Windows.Forms.TextBox()
        Me.tbFc = New System.Windows.Forms.TextBox()
        Me.tbFcAmt = New System.Windows.Forms.TextBox()
        Me.tbCusCode = New System.Windows.Forms.TextBox()
        Me.GroupPanel1 = New DevComponents.DotNetBar.Controls.GroupPanel()
        Me.cmdExit = New DevComponents.DotNetBar.ButtonX()
        Me.cmdSave = New DevComponents.DotNetBar.ButtonX()
        Me.cbCustomer = New DevComponents.DotNetBar.Controls.ComboBoxEx()
        Me.GroupPanel2 = New DevComponents.DotNetBar.Controls.GroupPanel()
        Me.LabelX5 = New DevComponents.DotNetBar.LabelX()
        Me.LabelX4 = New DevComponents.DotNetBar.LabelX()
        Me.LabelX3 = New DevComponents.DotNetBar.LabelX()
        Me.LabelX2 = New DevComponents.DotNetBar.LabelX()
        Me.LabelX1 = New DevComponents.DotNetBar.LabelX()
        Me.GroupPanel1.SuspendLayout()
        Me.GroupPanel2.SuspendLayout()
        Me.SuspendLayout()
        '
        'tbDocNum
        '
        Me.tbDocNum.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbDocNum.Location = New System.Drawing.Point(72, 88)
        Me.tbDocNum.MaxLength = 10
        Me.tbDocNum.Name = "tbDocNum"
        Me.tbDocNum.Size = New System.Drawing.Size(108, 26)
        Me.tbDocNum.TabIndex = 2
        '
        'rbDmemo
        '
        Me.rbDmemo.AutoSize = True
        Me.rbDmemo.BackColor = System.Drawing.Color.Transparent
        Me.rbDmemo.Checked = True
        Me.rbDmemo.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.rbDmemo.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbDmemo.Location = New System.Drawing.Point(3, 7)
        Me.rbDmemo.Name = "rbDmemo"
        Me.rbDmemo.Size = New System.Drawing.Size(103, 22)
        Me.rbDmemo.TabIndex = 42
        Me.rbDmemo.TabStop = True
        Me.rbDmemo.Text = "Debit Memo"
        Me.rbDmemo.UseVisualStyleBackColor = False
        '
        'rbCmemo
        '
        Me.rbCmemo.AutoSize = True
        Me.rbCmemo.BackColor = System.Drawing.Color.Transparent
        Me.rbCmemo.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.rbCmemo.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.rbCmemo.Location = New System.Drawing.Point(128, 7)
        Me.rbCmemo.Name = "rbCmemo"
        Me.rbCmemo.Size = New System.Drawing.Size(107, 22)
        Me.rbCmemo.TabIndex = 43
        Me.rbCmemo.Text = "Credit Memo"
        Me.rbCmemo.UseVisualStyleBackColor = False
        '
        'tbRefer
        '
        Me.tbRefer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbRefer.Location = New System.Drawing.Point(72, 122)
        Me.tbRefer.MaxLength = 50
        Me.tbRefer.Name = "tbRefer"
        Me.tbRefer.Size = New System.Drawing.Size(236, 26)
        Me.tbRefer.TabIndex = 3
        '
        'tbFc
        '
        Me.tbFc.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbFc.Location = New System.Drawing.Point(72, 156)
        Me.tbFc.MaxLength = 3
        Me.tbFc.Name = "tbFc"
        Me.tbFc.Size = New System.Drawing.Size(108, 26)
        Me.tbFc.TabIndex = 50
        Me.tbFc.Text = "USD"
        '
        'tbFcAmt
        '
        Me.tbFcAmt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbFcAmt.Location = New System.Drawing.Point(72, 190)
        Me.tbFcAmt.MaxLength = 12
        Me.tbFcAmt.Name = "tbFcAmt"
        Me.tbFcAmt.Size = New System.Drawing.Size(108, 26)
        Me.tbFcAmt.TabIndex = 52
        '
        'tbCusCode
        '
        Me.tbCusCode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.tbCusCode.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
        Me.tbCusCode.Location = New System.Drawing.Point(72, 25)
        Me.tbCusCode.Name = "tbCusCode"
        Me.tbCusCode.Size = New System.Drawing.Size(108, 26)
        Me.tbCusCode.TabIndex = 54
        '
        'GroupPanel1
        '
        Me.GroupPanel1.CanvasColor = System.Drawing.SystemColors.Control
        Me.GroupPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007
        Me.GroupPanel1.Controls.Add(Me.cmdExit)
        Me.GroupPanel1.Controls.Add(Me.cmdSave)
        Me.GroupPanel1.Controls.Add(Me.cbCustomer)
        Me.GroupPanel1.Controls.Add(Me.GroupPanel2)
        Me.GroupPanel1.Controls.Add(Me.LabelX5)
        Me.GroupPanel1.Controls.Add(Me.LabelX4)
        Me.GroupPanel1.Controls.Add(Me.LabelX3)
        Me.GroupPanel1.Controls.Add(Me.LabelX2)
        Me.GroupPanel1.Controls.Add(Me.LabelX1)
        Me.GroupPanel1.Controls.Add(Me.tbCusCode)
        Me.GroupPanel1.Controls.Add(Me.tbFcAmt)
        Me.GroupPanel1.Controls.Add(Me.tbFc)
        Me.GroupPanel1.Controls.Add(Me.tbRefer)
        Me.GroupPanel1.Controls.Add(Me.tbDocNum)
        Me.GroupPanel1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.GroupPanel1.Location = New System.Drawing.Point(0, 0)
        Me.GroupPanel1.Name = "GroupPanel1"
        Me.GroupPanel1.Size = New System.Drawing.Size(478, 338)
        '
        '
        '
        Me.GroupPanel1.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2
        Me.GroupPanel1.Style.BackColorGradientAngle = 90
        Me.GroupPanel1.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground
        Me.GroupPanel1.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderBottomWidth = 1
        Me.GroupPanel1.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder
        Me.GroupPanel1.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderLeftWidth = 1
        Me.GroupPanel1.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderRightWidth = 1
        Me.GroupPanel1.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel1.Style.BorderTopWidth = 1
        Me.GroupPanel1.Style.CornerDiameter = 4
        Me.GroupPanel1.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded
        Me.GroupPanel1.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center
        Me.GroupPanel1.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText
        Me.GroupPanel1.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near
        Me.GroupPanel1.TabIndex = 55
        Me.GroupPanel1.Text = "AP-Vendor - Add"
        '
        'cmdExit
        '
        Me.cmdExit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdExit.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdExit.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdExit.Location = New System.Drawing.Point(366, 255)
        Me.cmdExit.Name = "cmdExit"
        Me.cmdExit.Size = New System.Drawing.Size(82, 27)
        Me.cmdExit.TabIndex = 229
        Me.cmdExit.Text = "Exit"
        '
        'cmdSave
        '
        Me.cmdSave.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
        Me.cmdSave.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.cmdSave.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(64, Byte), Integer))
        Me.cmdSave.Location = New System.Drawing.Point(278, 255)
        Me.cmdSave.Name = "cmdSave"
        Me.cmdSave.Size = New System.Drawing.Size(82, 26)
        Me.cmdSave.TabIndex = 228
        Me.cmdSave.Text = "Save"
        '
        'cbCustomer
        '
        Me.cbCustomer.DisplayMember = "Text"
        Me.cbCustomer.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cbCustomer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cbCustomer.ItemHeight = 19
        Me.cbCustomer.Location = New System.Drawing.Point(72, 57)
        Me.cbCustomer.Name = "cbCustomer"
        Me.cbCustomer.Size = New System.Drawing.Size(376, 25)
        Me.cbCustomer.TabIndex = 57
        '
        'GroupPanel2
        '
        Me.GroupPanel2.CanvasColor = System.Drawing.SystemColors.Control
        Me.GroupPanel2.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007
        Me.GroupPanel2.Controls.Add(Me.rbDmemo)
        Me.GroupPanel2.Controls.Add(Me.rbCmemo)
        Me.GroupPanel2.Location = New System.Drawing.Point(204, 156)
        Me.GroupPanel2.Name = "GroupPanel2"
        Me.GroupPanel2.Size = New System.Drawing.Size(244, 60)
        '
        '
        '
        Me.GroupPanel2.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2
        Me.GroupPanel2.Style.BackColorGradientAngle = 90
        Me.GroupPanel2.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground
        Me.GroupPanel2.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel2.Style.BorderBottomWidth = 1
        Me.GroupPanel2.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder
        Me.GroupPanel2.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel2.Style.BorderLeftWidth = 1
        Me.GroupPanel2.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel2.Style.BorderRightWidth = 1
        Me.GroupPanel2.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid
        Me.GroupPanel2.Style.BorderTopWidth = 1
        Me.GroupPanel2.Style.CornerDiameter = 4
        Me.GroupPanel2.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded
        Me.GroupPanel2.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center
        Me.GroupPanel2.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText
        Me.GroupPanel2.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near
        Me.GroupPanel2.TabIndex = 56
        Me.GroupPanel2.Text = "Document Type"
        '
        'LabelX5
        '
        Me.LabelX5.BackColor = System.Drawing.Color.Transparent
        Me.LabelX5.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.LabelX5.Location = New System.Drawing.Point(6, 190)
        Me.LabelX5.Name = "LabelX5"
        Me.LabelX5.Size = New System.Drawing.Size(60, 23)
        Me.LabelX5.TabIndex = 55
        Me.LabelX5.Text = "FC Amt"
        '
        'LabelX4
        '
        Me.LabelX4.BackColor = System.Drawing.Color.Transparent
        Me.LabelX4.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.LabelX4.Location = New System.Drawing.Point(6, 157)
        Me.LabelX4.Name = "LabelX4"
        Me.LabelX4.Size = New System.Drawing.Size(60, 23)
        Me.LabelX4.TabIndex = 55
        Me.LabelX4.Text = "FC"
        '
        'LabelX3
        '
        Me.LabelX3.BackColor = System.Drawing.Color.Transparent
        Me.LabelX3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.LabelX3.Location = New System.Drawing.Point(6, 122)
        Me.LabelX3.Name = "LabelX3"
        Me.LabelX3.Size = New System.Drawing.Size(60, 23)
        Me.LabelX3.TabIndex = 55
        Me.LabelX3.Text = "Details"
        '
        'LabelX2
        '
        Me.LabelX2.BackColor = System.Drawing.Color.Transparent
        Me.LabelX2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.LabelX2.Location = New System.Drawing.Point(6, 90)
        Me.LabelX2.Name = "LabelX2"
        Me.LabelX2.Size = New System.Drawing.Size(60, 23)
        Me.LabelX2.TabIndex = 55
        Me.LabelX2.Text = "Doc #"
        '
        'LabelX1
        '
        Me.LabelX1.BackColor = System.Drawing.Color.Transparent
        Me.LabelX1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.LabelX1.Location = New System.Drawing.Point(6, 25)
        Me.LabelX1.Name = "LabelX1"
        Me.LabelX1.Size = New System.Drawing.Size(60, 23)
        Me.LabelX1.TabIndex = 55
        Me.LabelX1.Text = "Supplier"
        '
        'frmGLAPTransAdd
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(7, 19)
        Me.BackColor = System.Drawing.SystemColors.ActiveCaption
        Me.ClientSize = New System.Drawing.Size(478, 338)
        Me.ControlBox = False
        Me.Controls.Add(Me.GroupPanel1)
        Me.Font = New System.Drawing.Font("Calibri", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ForeColor = System.Drawing.SystemColors.ControlLightLight
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmGLAPTransAdd"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.GroupPanel1.ResumeLayout(False)
        Me.GroupPanel1.PerformLayout()
        Me.GroupPanel2.ResumeLayout(False)
        Me.GroupPanel2.PerformLayout()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
        If ValidateInputData() = True Then
            GlApSupID = cbCustomer.SelectedValue
            GlApSupName = "A/P:" & cbCustomer.Text
            GlApDocNum = tbDocNum.Text
            GlApFc = tbFc.Text
            GlApFcAmt = tbFcAmt.Text
            If rbDmemo.Checked = True Then
                GlApDocType = "D"
            End If
            If rbCmemo.Checked = True Then
                GlApDocType = "C"
            End If
            GlApDocRefer = tbRefer.Text
            Me.Close()
        End If
    End Sub

    Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
        If ValidateInputData() = True Then
            GlApSupID = cbCustomer.SelectedValue
            GlApSupName = "A/P:" & cbCustomer.Text
            GlApDocNum = tbDocNum.Text
            GlApFc = tbFc.Text
            GlApFcAmt = tbFcAmt.Text
            If rbDmemo.Checked = True Then
                GlApDocType = "D"
            End If
            If rbCmemo.Checked = True Then
                GlApDocType = "C"
            End If
            GlApDocRefer = tbRefer.Text
            Me.Close()
        End If
    End Sub

    Private Sub ARgroupsAdd_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim ICdata As New ICdataLogic
        Dim ds2 As DataSet
        ds2 = ICdata.GetCompanySuppliers(CompanyID)
        cbCustomer.DataSource = ds2.Tables(0)
        cbCustomer.ValueMember = "SupID"
        cbCustomer.DisplayMember = "SupName"
        If IsNumeric(GlApSupID) Then
            If GlApSupID > 0 Then
                cbCustomer.SelectedValue = GlApSupID
                Dim APdata As New APdataLogic
                Dim CusCode As String
                CusCode = APdata.GetSupplierCode(GlApSupID)
                tbCusCode.Text = CusCode
                APdata = Nothing
                tbDocNum.Text = GlApDocNum
                If GlApDocType = "D" Then
                    rbDmemo.Checked = True
                End If
                If GlApDocType = "C" Then
                    rbCmemo.Checked = True
                End If
                tbRefer.Text = GlApDocRefer
                tbFc.Text = GlApFc
                tbFcAmt.Text = GlApFcAmt
            End If
        End If

    End Sub
    Private Function ValidateInputData() As Boolean
        If Not IsNumeric(cbCustomer.SelectedValue) Then
            MsgBox("Select Supplier", MsgBoxStyle.Critical, "Inventory Manager")
            cbCustomer.Focus()
            Return False
        End If
        Return True
    End Function
    Private Sub cbCustomer_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        AutoCompleteCombo_KeyUp(cbCustomer, e)
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{Tab}")
        End If
    End Sub
    Private Sub cbCustomer_Leave(ByVal sender As Object, ByVal e As System.EventArgs)
        AutoCompleteCombo_Leave(cbCustomer)
    End Sub
    Private Sub tbCusCode_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbCusCode.LostFocus
        If tbCusCode.Text.Trim <> "" Then
            Dim APdata As New APdataLogic
            Dim CusID As Integer
            CusID = APdata.GetSupplierID(tbCusCode.Text)
            If CusID = 0 Then
                MsgBox("Invalid Supplier Code!", MsgBoxStyle.Critical, "Inventory Manager")
                tbCusCode.Clear()
            Else
                cbCustomer.SelectedValue = CusID
            End If
        End If
    End Sub

    Private Sub cbCustomer_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbCustomer.SelectedIndexChanged
        If IsNumeric(cbCustomer.SelectedValue) Then
            Dim APdata As New APdataLogic
            Dim CusCode As String
            CusCode = APdata.GetSupplierCode(cbCustomer.SelectedValue)
            If CusCode.Trim = "" Then
                MsgBox("Invalid Supplier!", MsgBoxStyle.Critical, "Inventory Manager")
                tbCusCode.Clear()
            Else
                tbCusCode.Text = CusCode
            End If
        End If
    End Sub

  
End Class
